package demo4;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: liangyuanzhang
 * Date: 2025-2-28
 * Time: 8:26
 */
interface IA {
    void testA();
}
interface IB {
    void testB();
}
//
interface IC extends IB,IA{
    void testC();
}

class D implements IC {

    @Override
    public void testA() {

    }

    @Override
    public void testB() {

    }

    @Override
    public void testC() {

    }
}

public class Test {
    public static void main(String[] args) {
        Dog dog1 =  new Dog("旺财",11);
        Dog dog2 =  new Dog("旺财",11);

        System.out.println(dog1 == dog2);
        System.out.println(dog1.equals(dog2));
        System.out.println(dog1.equals(dog1));
        System.out.println("=====");

        System.out.println(dog1.hashCode());
        System.out.println(dog2.hashCode());

        //Duck obj2 =  new Duck("唐老鸭",7);




    }

    public static void func1(Animal animal) {
        animal.eat();
    }

    public static void walk(IRunning iRunning) {
        iRunning.run();
    }

    public static void fly(IFly iFly) {
        iFly.fly();
    }

    public static void swimming(ISwimming iSwimming) {
        iSwimming.swim();
    }

    public static void main5(String[] args) {
        walk(new Robot());
    }

    public static void main3(String[] args) {
        walk(new Duck("唐老鸭",7));
        walk(new Dog("旺财",11));

        System.out.println("======");
        fly(new Duck("唐老鸭",7));
        System.out.println("======");

        swimming(new Duck("唐老鸭",7));
        swimming(new Dog("旺财",11));
        swimming(new Fish("小鱼儿",31));

    }

    public static void main1(String[] args) {
        func1(new Duck("唐老鸭",7));
        func1(new Dog("旺财",11));
        func1(new Fish("小鱼儿",31));
    }
}
